function mutiRequest(urls = [], max) {
    const len = urls.length
    const result = new Array(len).fill(false)
    let count = 0 //当前完成数量
    return new Promise((resolve, reject)=> {
        while(count < max) {
            next()
        }

        function next() {
            let current = count++
            if(current >= max) {
                !result.includes(false) && resolve(result)
                return
            }

            const url = urls[current]
            fetch(url).then(res => {
                result[current] = res
                if(current < max) next()
            }).catch(err => {
                result[current] = err
                if(current < max) next()
            })
        }
    })
}

function fetch(url) {
    console.log(`向${url}发送请求`)
}

